package com.burns.rbac.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.burns.rbac.dto.UserDto;
import com.burns.rbac.entity.Emp;
import com.burns.rbac.entity.User;
import com.burns.rbac.mapper.EmpMapper;
import com.burns.rbac.mapper.UserMapper;
import com.burns.rbac.service.IEmpService;
import com.burns.rbac.service.IUserService;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
    @Override
    public User getUserByUsername(UserDto userDto) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("username", userDto.getUsername());
        User user = super.baseMapper.selectOne(wrapper);
        return user;
    }

    @Override
    public User getUserByUsername(String username) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("username", username);
        User user = super.baseMapper.selectOne(wrapper);
        return user;
    }
}
